package Operation;
import book.BookList;
import java.util.Scanner;
import book.Book;
public class Del implements Operation{
    @Override
    public void work(BookList bookList) {
        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入要删除的书名");
        String name = scanner.nextLine();
        int size = bookList.getUsedSize();
        for (int i = 0; i <size ; i++) {
            if(bookList.getBooks(i).equals(name)){
                for (int j = i+1; j <size ; j++) {
                    Book book=bookList.getBooks(j);
                    bookList.setBooks(j-1,book);
                }
            }
        }
        System.out.println("没有你删除的这本书");
    }
}


